﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CCPnuts.ISkyDiskFileSystem.Interfaces;
using CCPnuts.ISkyDiskFileSystem;
using HgCo.WindowsLive.SkyDrive;

namespace SkyDiskFileSystem
{
    internal class SkyElementCollection : List<I_SkyElement>, I_SkyElementCollection
    {
        private SkyElementCollection() { }

        internal SkyElementCollection(SkyDriveWebClient client, I_SkyDirectory parent, WebFolderItemInfo[] itemInfo)
        {
            foreach (var d in itemInfo)
            {
                if (d != null && d.ItemType == WebFolderItemType.Folder)
                {
                    Add(new SkyDirectory(client, parent, d as WebFolderInfo));
                }
                else if (d != null && d.ItemType == WebFolderItemType.File)
                {
                    Add(new SkyFile(parent, d as WebFileInfo));
                }
            }
        }

        #region IPacked Members

        private CCPnuts.Pack.PackedInfo m_packedInfo = PackedInfos.SkyElementCollection;

        public CCPnuts.Pack.PackedInfo _PackedInfo
        {
            get { return m_packedInfo; }
        }

        #endregion
    }
}
